

package commandz.cli;


/**
 *  Interface for Interpreter feed-back.
 *
 *  Implement this interface to process feed-back during the interpretation
 *  of commands. Appliances are, for example, error-reporting, logging, etc.
 */
public interface InterpreterFeedback
{
    /**
     *  Invoked when the number of arguments doesnt equal the
     *  number of defined parameters for a particular command.
     *
     *  @param source   The interpreter that is invoking this method.
     *  @param cmd      The command for which the arguments are processed.
     *  @param expected The number of expected arguments.
     *  @param provided The number of provided arguments.
     */
    void argumentMismatch(final Interpreter source, final Command cmd,
                          final int expected, final int provided);

    /**
     *  Invoked when the value of an argument couldn't be parsed
     *  into the corresponding parameter.
     *
     *  @param source    The interpreter that is invoking this method.
     *  @param cmd       The command for which the arguments are processed.
     *  @param parameter The parameter that is parsing the argument.
     *  @param argument  The value of the argument that couldn't be parsed.
     */
    void argumentError(final Interpreter source, final Command cmd,
                       final Parameter parameter, final String argument);

    /**
     *  Invoked when the interpreter encounters an unknown command.
     *
     *  @param source     The interpreter that is invoking this method.
     *  @param identifier The string that identifies an unknown command.
     */
    void unknownCommand(final Interpreter source, final String identifier);
}
